import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '姓名',
    align: "center",
    sorter: true,
    dataIndex: 'reportUser'
  },
  {
    title: '项目',
    align: "center",
    sorter: true,
    dataIndex: 'projectId_dictText'
  },
  {
    title: '系统',
    align: "center",
    sorter: true,
    dataIndex: 'systemName_dictText'
  },
  // {
  //   title: '项目批次',
  //   align: "center",
  //   sorter: true,
  //   dataIndex: 'projectBatch_dictText'
  // },
   {
    title: '是否上线',
    align: "center",
    sorter: true,
    dataIndex: 'online_dictText'
  },
   {
    title: '上线问题',
    align: "center",
    sorter: true,
    dataIndex: 'onlineIssue_dictText'
  },
  {
    title: '编写用例数',
    align: "center",
    sorter: true,
    dataIndex: 'writeCaseNum'
  },
  {
    title: '执行用例数',
    align: "center",
    sorter: true,
    dataIndex: 'executeCaseNum'
  },
  {
    title: '提交缺陷数',
    align: "center",
    sorter: true,
    dataIndex: 'defectBugNum'
  },
  {
    title: '参会数',
    align: "center",
    sorter: true,
    dataIndex: 'attendMeeting'
  },
  {
    title: '项目经理',
    align: "center",
    sorter: true,
    dataIndex: 'pm_dictText'
  },
  // {
  //   title: '本周工作',
  //   align: "center",
  //   sorter: true,
  //   dataIndex: 'weekJob'
  // },
  // {
  //   title: '下周工作',
  //   align: "center",
  //   sorter: true,
  //   dataIndex: 'nextWeekJob'
  // },
  // {
  //   title: '项目风险',
  //   align: "center",
  //   dataIndex: 'projectRisk'
  // },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "汇报人",
    field: 'reportUser',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "项目",
    field: 'projectId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project,project_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "系统",
    field: 'systemName',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project_system,system_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "项目批次",
    field: 'projectBatch',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project_batch,batch_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "项目经理",
    field: 'pm',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,username"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '汇报人',
    field: 'reportUser',
    component: 'Input',
    dynamicDisabled: true
  },
  {
    label: '项目',
    field: 'projectId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project,project_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目!'},
             ];
    },
  },
  {
    label: '系统',
    field: 'systemName',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project_system,system_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入系统!'},
             ];
    },
  },
  {
    label: '项目批次',
    field: 'projectBatch',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project_batch,batch_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目批次!'},
             ];
    },
  },
  {
    label: '项目经理',
    field: 'pm',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,username"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目经理!'},
             ];
    },
  },
  {
    label: '编写用例数',
    field: 'writeCaseNum',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入编写用例数!'},
             ];
    },
  },
  {
    label: '执行用例数',
    field: 'executeCaseNum',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入执行用例数!'},
             ];
    },
  },
  {
    label: '提交缺陷数',
    field: 'defectBugNum',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入提交缺陷数!'},
             ];
    },
  },
  {
    label: '参会数',
    field: 'attendMeeting',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入参会数!'},
             ];
    },
  },
  {
    label: '本周工作',
    field: 'weekJob',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入本周工作!'},
             ];
    },
  },
  {
    label: '下周工作',
    field: 'nextWeekJob',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入下周工作!'},
             ];
    },
  },
  {
    label: '项目风险',
    field: 'projectRisk',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目风险!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  reportUser: {title: '汇报人',order: 0,view: 'text', type: 'string',},
  projectId: {title: '项目',order: 1,view: 'sel_search', type: 'string',dictTable: "tm_project", dictCode: 'id', dictText: 'project_name',},
  systemName: {title: '系统',order: 2,view: 'sel_search', type: 'string',dictTable: "tm_project_system", dictCode: 'id', dictText: 'system_name',},
  projectBatch: {title: '项目批次',order: 3,view: 'sel_search', type: 'string',dictTable: "tm_project_batch", dictCode: 'id', dictText: 'batch_name',},
  pm: {title: '项目经理',order: 4,view: 'sel_search', type: 'string',dictTable: "sys_user", dictCode: 'username', dictText: 'realname',},
  writeCaseNum: {title: '编写用例数',order: 5,view: 'number', type: 'number',},
  executeCaseNum: {title: '执行用例数',order: 6,view: 'number', type: 'number',},
  defectBugNum: {title: '提交缺陷数',order: 7,view: 'number', type: 'number',},
  attendMeeting: {title: '参会数',order: 8,view: 'number', type: 'number',},
  weekJob: {title: '本周工作',order: 9,view: 'textarea', type: 'string',},
  nextWeekJob: {title: '下周工作',order: 10,view: 'textarea', type: 'string',},
  projectRisk: {title: '项目风险',order: 11,view: 'textarea', type: 'string',},
};
